package agentes;

import java.awt.Color;
import java.util.LinkedList;
import java.util.Random;

import alice.tuprolog.SolveInfo;
import alice.tuprolog.Struct;

import libraries.PolygonLibraryManipulator;
import test.Coordinate;
import test.Polygon;

public class Lucifer extends Thread{
	PolygonLibraryManipulator engine = new PolygonLibraryManipulator();
	LinkedList<Coordinate> vortexList;
	int c = 0;

	public Lucifer(PolygonLibraryManipulator engine) throws Exception {
		this.engine = engine;
		vortexList = new LinkedList<Coordinate>();

	}

	@Override
	public void run() {
		while (true) {
			try {
				System.out.println("awaking lucifer: muhahahah");
				engine.awakeAgent(this.getClass().getSimpleName().toLowerCase());
				engine.runPsys();
				System.out.println("psys done");
				SolveInfo info = engine.getEngine().solve("isAwake(lucifer).");
				if(info.isSuccess()){
					System.out.println("lucifer is still awake...");
				}
//					Struct s = (Struct) info.getTerm("X");
//					System.out.println("isAwake - "+s.getTerm().toString());
////					engine.runPsys();
////					System.out.println("Psys DONE");
//					info = engine.getEngine().solve("isAwake(X).");
//					if(info.isSuccess()){
//						s = (Struct) info.getTerm("X");
//						System.out.println("isAwake - "+s.getTerm().toString());
//					}
//				}
				Thread.sleep(5000);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}

	}

}
